import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:lottie/lottie.dart';

import '../../../util.dart';

class EmptyView extends StatelessWidget {
  EmptyView({
    this.top,
    this.title = '暂无数据',
    this.onTap,
  });
  double? top;
  String title;
  Function()? onTap;
  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        // LottieBuilder.network(
        //   'https://assets1.lottiefiles.com/packages/lf20_MrIjH2.json',
        //   width: Get.width - 2 * gap12,
        //   fit: BoxFit.contain,
        // ),
        Container(
          height: top ?? Get.height * 0.05,
        ),
        loadImage(
          url: 'ic_nodata.png'.imgPathHome,
          width: Get.width * 0.5,
          fit: BoxFit.fitWidth,
        ),
        SizedBox(
          height: 20.r,
        ),
        TextButton(
          onPressed: onTap,
          child: Text(
            title,
            style: pfMediumStyle(
                color: onTap == null ? ColorsUtil.content : ColorsUtil.green,
                fontSize: 13.sp),
          ),
        ),
        Container(
          constraints: BoxConstraints(
            minHeight: top ?? Get.height * 0.1,
          ),
        )
      ],
    );
  }
}
